#pragma GCC optimize(2)
#pragma GCC optimize(3)

#include <bits/stdc++.h>

using namespace std;
typedef long long LL;
const int N = 5e6 + 3;
#define fi first
#define se second
#define pb push_back
#define wzh(x) cerr<<#x<<'='<<x<<endl;
char a[N];
const int mod = 1e9 + 7;

int add(int x, int y) {
    x += y;
    if (x >= mod)x -= mod;
    if (x < 0)x += mod;
    return x;
}

int mul(int x, int y) {
    return 1ll * x * y % mod;
}

int sub(int x, int y) {
    x = x + mod - y;
    if (x >= mod)x -= mod;
    return x;
}

int ksm(int x, int y, int z = 1) {
    for (; y; y >>= 1, x = mul(x, x))if (y & 1)z = mul(z, x);
    return z;
}

int fac[N], inv[N];

void P() {
    fac[0] = 1;
    for (int i = 1; i < N; i++)fac[i] = mul(fac[i - 1], i);
    inv[N - 1] = ksm(fac[N - 1], mod - 2);
    for (int i = N - 2; i >= 0; i--)inv[i] = mul(inv[i + 1], i + 1);
}

int di(int x, int y) {
    return mul(x, ksm(y, mod - 2));
}

LL C(int x, int y) {
    if (x < y)return 0;
    return mul(fac[x], mul(inv[y], inv[x - y]));
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> a + 1;
    int n = strlen(a + 1);
    int ans = 1;
    for (int i = 1; i <= n; i++) {
        ans = mul(ans, ksm(a[i] - '0', i));
    }
    cout << ans << '\n';
    return 0;
}
